UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cnY6nRdHFuzMiU81t1OSu2++Hz8j/lxvl6346Xzk3c4='
WHERE
key_id = 'fc0ff8da767e6890598f7541e0e97e949ab30027b3aee97d2f7cc1ce1e6e7959'
AND (
token = 'cnY6nRdHFuzMiU81t1OSu2++Hz8j/lxvl6346Xzk3c4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)