UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n9bGM6I8HWDu6zRvdq3Rt3e3t3ZOQTok/9CmdZix5Ao=' 
WHERE 
  key_id = 'e9f4e867028bd6aa56acf12c409d6bf7259ace779ed2dc7f22090db0ff52cff2' 
  AND (
    token = 'n9bGM6I8HWDu6zRvdq3Rt3e3t3ZOQTok/9CmdZix5Ao=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032