UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S+M025BgYS1+XyCMBEo43u0Fb5B6n1OI47pAeVFLPRs=' 
WHERE 
  key_id = '3af5b9f9798257330299b65e228f55875857ae005e9adb93f42ec9d12b2d16c6' 
  AND (
    token = 'S+M025BgYS1+XyCMBEo43u0Fb5B6n1OI47pAeVFLPRs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044