UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fJ1WkxPoDOaX7x1FgokHsltOZfVPIXkE+h3wsJPxsPk=' 
WHERE 
  key_id = 'ad39127d7d8fc8421d0c89aaabd7bb2887e799df5f97ecb7979d129598e856e7' 
  AND (
    token = 'fJ1WkxPoDOaX7x1FgokHsltOZfVPIXkE+h3wsJPxsPk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046