UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cZ7WD9Hxx1c91ndQjuuMmb6NGca4xKrx5UsH9ALV2R8=' 
WHERE 
  key_id = '63d2fbe6f121e01db2e3b493703cf1c0fc9818ba78b5e65102730a94d2b8de13' 
  AND (
    token = 'cZ7WD9Hxx1c91ndQjuuMmb6NGca4xKrx5UsH9ALV2R8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017