UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TvgjV9nGbcgv3Yt68vlgN30eUBcMB4vHQq6ToSHDfkk='
WHERE
key_id = '54c23ab2ab326a66b97b4a6033128352c8bd6477cc62c262934344a6eabed2f9'
AND (
token = 'TvgjV9nGbcgv3Yt68vlgN30eUBcMB4vHQq6ToSHDfkk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)