UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tLUGHEzybiaewFsHZx665KrCH1R3/pfLcnH6JigneME=' 
WHERE 
  key_id = 'b1e014b555f770d00f159b03efe349609d1f56c4adcbe3b2276d13ee715528ff' 
  AND (
    token = 'tLUGHEzybiaewFsHZx665KrCH1R3/pfLcnH6JigneME=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037