UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FMONHfVvxhYqAbvEjzAUfxIs8R+bSU5W13TtPFtNZO0=' 
WHERE 
  key_id = '5e5456b0be2336e186b373a2686a214388a05164a9ac24ee1a9cdb3e8d8e671e' 
  AND (
    token = 'FMONHfVvxhYqAbvEjzAUfxIs8R+bSU5W13TtPFtNZO0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040