UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bTcKYaOqclHU214d+x8EVS+YnsNNtQUEf3NuCTXQ8w4='
WHERE
key_id = 'e7d2d84f2082c0a802d6d0bc055fcda55bdaece42a89b84759e346976dbc3a04'
AND (
token = 'bTcKYaOqclHU214d+x8EVS+YnsNNtQUEf3NuCTXQ8w4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)