UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oI8XX6fvIYR9wOch4Gh/ipEfU2a7NYbRIU76+p57Tnk='
WHERE
key_id = '89a167ac50bd0405f5c6b15380ec572e7f050f261d1e8d360ef133300960c749'
AND (
token = 'oI8XX6fvIYR9wOch4Gh/ipEfU2a7NYbRIU76+p57Tnk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)