UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wQwx7h0hRWJz+3RIv6FVFp703qRv9ZAoiCGBvco478Q=' 
WHERE 
  key_id = '8cddc6b36b613187321e61990cdce05ce332ef2e45f6afd56fc018aa935959bd' 
  AND (
    token = 'wQwx7h0hRWJz+3RIv6FVFp703qRv9ZAoiCGBvco478Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026