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