UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zN9+yKldcIgIysBfHweSCVyKrg0RugE5WrASfH9pTuM='
WHERE
key_id = 'a02e0b697217d7d11c06102a31d91d2daf9d55a0f0bd3224b86d53ff27d378cc'
AND (
token = 'zN9+yKldcIgIysBfHweSCVyKrg0RugE5WrASfH9pTuM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)