UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8f61UIupZVQ+5/H1qxcyhOfSbqF3PtViSdMH4E5Z9W8='
WHERE
key_id = 'c988a87a08b0440a0c31a22ba4244539382dab693eb2d9c928f0c88fbb09f422'
AND (
token = '8f61UIupZVQ+5/H1qxcyhOfSbqF3PtViSdMH4E5Z9W8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)