UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gw1WAcBAbQQ8USTagxoQ4ih+VLYduemLXm8QqIsmGBk=' 
WHERE 
  key_id = 'a9bc91979daa9d4e911ba5f0c916c7b10eba682906894c0f78651f49d59b6808' 
  AND (
    token = 'Gw1WAcBAbQQ8USTagxoQ4ih+VLYduemLXm8QqIsmGBk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033