UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '56qkGFJ1PYEsMRYqKvzVEn0fU8wOETU3xYApXJogciQ='
WHERE
key_id = '8e4f5ad4c6a8f075c78c16613508271b1c1b0eb5f564c8b9c07226129c25646a'
AND (
token = '56qkGFJ1PYEsMRYqKvzVEn0fU8wOETU3xYApXJogciQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)