UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rXI4n6mMkyTTE330/ZvktZcb1pcXx4SLF8KKACn30Rs='
WHERE
key_id = '116f816bc69dbcd0a5bb6fb242144487192fe66f26f084affea1efa4edca0ba6'
AND (
token = 'rXI4n6mMkyTTE330/ZvktZcb1pcXx4SLF8KKACn30Rs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)