UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lMHy1vVDHKsUp9KquHoiN/22Oe2uEiPMKpm51wUi3Hc='
WHERE
key_id = 'dafe5d67c482314eb9e3a84d60dc13d94a3a958b55044d0f24935736aa566b66'
AND (
token = 'lMHy1vVDHKsUp9KquHoiN/22Oe2uEiPMKpm51wUi3Hc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)