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