UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bHN/3Jbd6nsFGQ0WKOE2R9/9w1bYvgmGjkJJGdDb0ak=' 
WHERE 
  key_id = 'c8f4c55ddf2497c5dc9f7aae8f163061a87034701158a25909a0f217bcad4e48' 
  AND (
    token = 'bHN/3Jbd6nsFGQ0WKOE2R9/9w1bYvgmGjkJJGdDb0ak=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054