UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wM3beeKgF/cGG4oICRqzBzzwGPJCHEIB5kaD3+g7o3U='
WHERE
key_id = '4839dde508f4f77188c95547c8f71169e598e146f78b095b028e798ae5df445d'
AND (
token = 'wM3beeKgF/cGG4oICRqzBzzwGPJCHEIB5kaD3+g7o3U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)