UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ytXamdoLmHma06+BJzvsB/RnT9h+Vq78QAuCWRAWKDA=' 
WHERE 
  key_id = 'f6bcbb31a526b1f4432c2d9ba3f49c0c2513e0e1598e2c70523769021d73152d' 
  AND (
    token = 'ytXamdoLmHma06+BJzvsB/RnT9h+Vq78QAuCWRAWKDA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023