UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kDaW6jC7ACSh05xWFu0pggnH/BqBt6SvCGvdDr2Py4k=' 
WHERE 
  key_id = 'e2ba3571b1758dd096f65fda18a085be87023890874efff0b4d54fde07b51ce8' 
  AND (
    token = 'kDaW6jC7ACSh05xWFu0pggnH/BqBt6SvCGvdDr2Py4k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040