UPDATE
cscart_aprillock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nEBhmlHx6xofFct4yZkYKveyhenwheMPmqlTbGUuM3g='
WHERE
key_id = 'aa1251facf799315a71ce34a189f1696ffd645ee1c3adb0e790e1aa9f25af7dd'
AND (
token = 'nEBhmlHx6xofFct4yZkYKveyhenwheMPmqlTbGUuM3g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)