UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S9PzL4Qo+qCKuKBjXV3CaAPigxEbd6x1mWEsqgHSbPI=' 
WHERE 
  key_id = '4546527cd1993511f8480d67a5abcff678a1a0e3992416299eb8ae15ddb37f11' 
  AND (
    token = 'S9PzL4Qo+qCKuKBjXV3CaAPigxEbd6x1mWEsqgHSbPI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032