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