UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LZY5P8bNi+URAY+fPzem+8MyjSQF0CBNcMx88Yg6Jd4=' 
WHERE 
  key_id = '25bd1beafefc30d954fef79eb7f462715fad74bf40adce319c190ef53616914d' 
  AND (
    token = 'LZY5P8bNi+URAY+fPzem+8MyjSQF0CBNcMx88Yg6Jd4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025