UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R8b4ROE2GNCaP1UYJuSzyxVzbO9Lgcn6++X7IvAgS3g=' 
WHERE 
  key_id = '6f3bca9bad0d6f4a6a7de38f208292316dc845cdd7069c0be1e9ce995ef65203' 
  AND (
    token = 'R8b4ROE2GNCaP1UYJuSzyxVzbO9Lgcn6++X7IvAgS3g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031