UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HiL9AnRZZnz3I3CfPpj0X0IaR33bpSea2mitKKsS7x4=' 
WHERE 
  key_id = '361bc45eff1159310a34786a79f1e815517f4231d6d5b877fca75439b0681555' 
  AND (
    token = 'HiL9AnRZZnz3I3CfPpj0X0IaR33bpSea2mitKKsS7x4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037