UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A/GVxsbQ6XFI+61LuDqF5gfU2qroC7GfZN2leEjOyg0='
WHERE
key_id = 'a3079f1c0ce728f1f0f8f6893c70222cdabc5b3ece069971c616bbffe3eb3be5'
AND (
token = 'A/GVxsbQ6XFI+61LuDqF5gfU2qroC7GfZN2leEjOyg0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)