UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jABWZP1BHO31xzDfs1qhLbLxaUwLHB3fEkWyTxDEzZY='
WHERE
key_id = 'b6d788ba6dd76a981b9415a80f5e132a59b00576fde3b94511a1783419ebaf7c'
AND (
token = 'jABWZP1BHO31xzDfs1qhLbLxaUwLHB3fEkWyTxDEzZY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)