UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1elmyhwu+MgY0YnUtdetjvyJ52RBW/C3zV9sssmn058=' 
WHERE 
  key_id = '1d928fb001429b5890f15bce2b0791a4dbc62dc5329cd89cbaaa6303f833f5bc' 
  AND (
    token = '1elmyhwu+MgY0YnUtdetjvyJ52RBW/C3zV9sssmn058=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030