UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dqt1wY5Xns9Q0Sjb5RTuc90VZBaZ2EYJ9azAQjrcMVY=' 
WHERE 
  key_id = 'e1823b0eac42147a9004234c00bc52d62b8cb1a010f29440fc0c0a4f91471d6b' 
  AND (
    token = 'dqt1wY5Xns9Q0Sjb5RTuc90VZBaZ2EYJ9azAQjrcMVY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030