UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5cwdEhi+4kncOsn+TzscYDmiud33SRqrTH0ZIHqLSj4=' 
WHERE 
  key_id = '3d252d2cc9b7581d84689b2d69f103a00b0993e1c23808a0c7871a275e9be5e8' 
  AND (
    token = '5cwdEhi+4kncOsn+TzscYDmiud33SRqrTH0ZIHqLSj4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062