UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DgwyAsC/SfWs+XmWWGAgG4aHloZXxWqJEdC4dwMBHYU='
WHERE
key_id = 'a7e1a64c36eb07364f6b58f1171add2870b88b7308eb64fe8a9d7fc409fadef3'
AND (
token = 'DgwyAsC/SfWs+XmWWGAgG4aHloZXxWqJEdC4dwMBHYU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)