UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X+B9HhcMWOPyh5PaswXeaP+vqUaJS5Yhwe3aw1YXfLY='
WHERE
key_id = 'a4fd779b0cbda4c357bc2746edcda6f9e0193fd2d84551ef6d6359e9541d7b47'
AND (
token = 'X+B9HhcMWOPyh5PaswXeaP+vqUaJS5Yhwe3aw1YXfLY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)