UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gWr+mjLUGCBNn868uDQy/kIcWgSkuQb0rByI2knJVag=' 
WHERE 
  key_id = 'c873194e4f7bceea6104b56f4189718e27235fe1a20e74a52f5b66421358c483' 
  AND (
    token = 'gWr+mjLUGCBNn868uDQy/kIcWgSkuQb0rByI2knJVag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062