UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cWxlJU5OoXZPXnmPs4GitTZZj6g1NdrWmVbSXp2uEtI='
WHERE
key_id = '6e2ca4fe0bca5b7b9499bf5e840b7c18f10de477fd410907b309454154273732'
AND (
token = 'cWxlJU5OoXZPXnmPs4GitTZZj6g1NdrWmVbSXp2uEtI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)