UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y4sSBOrcaH+qAbK/+7Xz3csHoECmyN1mYB7ESv+4ImA=' 
WHERE 
  key_id = 'd4f1e2e612a8979b177334e64a7796465b822b84ae448b1b3c82430ffcbd1084' 
  AND (
    token = 'y4sSBOrcaH+qAbK/+7Xz3csHoECmyN1mYB7ESv+4ImA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023