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