UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oRxIrGEzSh2k4n8k4uuwDVjbfWW6bVpdf61HsSWK9+c='
WHERE
key_id = 'a1b2ccce4076b513bbda4a8122831071679e08277c77445b10eeccd6eac93bc8'
AND (
token = 'oRxIrGEzSh2k4n8k4uuwDVjbfWW6bVpdf61HsSWK9+c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)