UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OA9uw+wVaHrv1BfisuSSSGA+ifH8ZoscgYYiqXZNQAk=' 
WHERE 
  key_id = '3f60dafc50812e519d1ed0a62b4b72599f21b7ee4944b5b8f3fb44bae58d0049' 
  AND (
    token = 'OA9uw+wVaHrv1BfisuSSSGA+ifH8ZoscgYYiqXZNQAk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025