UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6gXiuM4FQwPg+25Qopp2c/xbGlWcEIYbnhilUyNCq60=' 
WHERE 
  key_id = '4459267b96b9e3698ce1eede6fcee15e2e56e3d8eb30ce21889cb9af2c510881' 
  AND (
    token = '6gXiuM4FQwPg+25Qopp2c/xbGlWcEIYbnhilUyNCq60=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034