UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nnnb1ee+YQoSYn2IppNTALxnBBJaOs/61o5q9JISFbw=' 
WHERE 
  key_id = '00dc509939f7f7c3f6d8160ad6103bceea97df86f22b6d99642e5a901776b9b3' 
  AND (
    token = 'nnnb1ee+YQoSYn2IppNTALxnBBJaOs/61o5q9JISFbw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045