UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aEMUYihD+uMFndz1ZRV7uyBSD5Vh8R8UQXGEfhbm08k=' 
WHERE 
  key_id = 'f989a123fc3deabfb0e847e1a934902b54bbee81ecb1d5340c15fbcf78864e29' 
  AND (
    token = 'aEMUYihD+uMFndz1ZRV7uyBSD5Vh8R8UQXGEfhbm08k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039