UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cl94p5VxD4IKHSDAhdqNLVXXpXciQDGg+VM/ZrQlWCA=' 
WHERE 
  key_id = 'a491e4369c5af5ff0f5423a209713f68e34cd9fcf11581fa708fe29be7710859' 
  AND (
    token = 'cl94p5VxD4IKHSDAhdqNLVXXpXciQDGg+VM/ZrQlWCA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026