UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rnVTMNAyDlVWZ8x5mgOfmHqWo1M7pNP19xGQMISvou8=' 
WHERE 
  key_id = '5e900be7251f0ce3989b0edcf1595935a2da9b6311e07ac4eab530a0b843216c' 
  AND (
    token = 'rnVTMNAyDlVWZ8x5mgOfmHqWo1M7pNP19xGQMISvou8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034