UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CMnoxPcxImjV0X8I3I/huZTDMifaBiYZQNzCUctB9Ko=' 
WHERE 
  key_id = '8da74f27411804639b794072af7fc073bad85600372883cab7500ad6d4b66e03' 
  AND (
    token = 'CMnoxPcxImjV0X8I3I/huZTDMifaBiYZQNzCUctB9Ko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025