UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qmU67uf2mbsRqX2FseE+AQwpcyJIvFqOLsWRYj0Lw2k='
WHERE
key_id = 'd47cd8fcfb24293a0807ba1aa99bbd5f92ceadbd6b991fbdc178f7aca706c4a5'
AND (
token = 'qmU67uf2mbsRqX2FseE+AQwpcyJIvFqOLsWRYj0Lw2k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)