UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6KgTWtvoXYSsz8iVI2XOWRTgdEquZTgGcO3MwQzi8r0=' 
WHERE 
  key_id = '3ddade94d55e45ef40f71981170fa78f5e77d859bc59104631530ddd32797a6f' 
  AND (
    token = '6KgTWtvoXYSsz8iVI2XOWRTgdEquZTgGcO3MwQzi8r0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043