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

Query time 0.00049