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