UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FimugkngIrO+lvVf0RkY3ItZcE6S3p9W7cRxShImTuw=' 
WHERE 
  key_id = '16ff85633ec37e7f7f72f44c0a55b5620d84e85154d2f634f7e4a307bb29be93' 
  AND (
    token = 'FimugkngIrO+lvVf0RkY3ItZcE6S3p9W7cRxShImTuw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045