UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qkh669FgxxyHe1D9atYaCWi9OUjN04QLY3EPQJNATWo='
WHERE
key_id = '7315b48b362620b46df80ecd7bbef88eb724ad78dc482ab0a839d9cbd79ea98b'
AND (
token = 'Qkh669FgxxyHe1D9atYaCWi9OUjN04QLY3EPQJNATWo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)