UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uynCYfQZlikhFEIw9v8juKUrl8kvYsRuNQj/UKKgpf0='
WHERE
key_id = 'a3bbe9080b4c3bbbf57798b9f57f76fe9cce05b2c2bd41b1af531acb86bd84ae'
AND (
token = 'uynCYfQZlikhFEIw9v8juKUrl8kvYsRuNQj/UKKgpf0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)