UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ycqav2l5JHu9hlFxeYAw5+aFFZfkfwDe+WqroJt+yBA='
WHERE
key_id = 'd9f2ebd1192725dbbc189832f2c94e3d974b248d3ab396805e36e821bf8ab904'
AND (
token = 'Ycqav2l5JHu9hlFxeYAw5+aFFZfkfwDe+WqroJt+yBA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)