UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6AQNjpVIL2Lh/mvdKM8dwc5waKlibuDaGTEVEGDptyI='
WHERE
key_id = '3f66af7d435528f61c9feaad9ead60baccbc63406a868b8df765193d15268630'
AND (
token = '6AQNjpVIL2Lh/mvdKM8dwc5waKlibuDaGTEVEGDptyI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)