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