UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6Za4hCF1MHKfRKsiCY7J1IGIGyLCULd+HqPLbsEFgZk=' 
WHERE 
  key_id = '812755fed9e941360f9a53c60a91fedceb8fd4e3f30067129105128ee1dac773' 
  AND (
    token = '6Za4hCF1MHKfRKsiCY7J1IGIGyLCULd+HqPLbsEFgZk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035