UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Rf0jGUCNhl8ezHLMB9GuLlfuwXihQ0txHcIr+1yVXts='
WHERE
key_id = '873ba416b96d9d2b527277fd379934ebf9ed3742c1a9c387445576d205113b46'
AND (
token = 'Rf0jGUCNhl8ezHLMB9GuLlfuwXihQ0txHcIr+1yVXts='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)